package yrl.socket;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class HelloServer {
protected static Logger logger=LogManager.getLogger(HelloServer.class.getName());
	public static void main(String[] args) throws IOException {
		ServerSocket server=new ServerSocket(8888);
		logger.info("服务器正在运行，等待客户端连接......");
		Socket client=server.accept();
		OutputStream out=client.getOutputStream();
		PrintWriter pw=new PrintWriter(out);
		pw.println("Hello World!");
		pw.close();
		client.close();
		server.close();
	}
}
